/*
 * jQuery UI 1.8.18
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(f, e) {
    function g(a) {
        return ! f(a).parents().andSelf().filter(function() {
            return f.curCSS(this, "visibility") === "hidden" || f.expr.filters.hidden(this)
        }).length
    }
    function h(a, l) {
        var k = a.nodeName.toLowerCase();
        if ("area" === k) {
            var j = a.parentNode,
            i = j.name,
            d;
            if (!a.href || !i || j.nodeName.toLowerCase() !== "map") {
                return ! 1
            }
            d = f("img[usemap=#" + i + "]")[0];
            return !! d && g(d)
        }
        return (/input|select|textarea|button|object/.test(k) ? !a.disabled: "a" == k ? a.href || l: l) && g(a)
    }
    f.ui = f.ui || {};
    f.ui.version || (f.extend(f.ui, {
        version: "1.8.18",
        keyCode: {
            ALT: 18,
            BACKSPACE: 8,
            CAPS_LOCK: 20,
            COMMA: 188,
            COMMAND: 91,
            COMMAND_LEFT: 91,
            COMMAND_RIGHT: 93,
            CONTROL: 17,
            DELETE: 46,
            DOWN: 40,
            END: 35,
            ENTER: 13,
            ESCAPE: 27,
            HOME: 36,
            INSERT: 45,
            LEFT: 37,
            MENU: 93,
            NUMPAD_ADD: 107,
            NUMPAD_DECIMAL: 110,
            NUMPAD_DIVIDE: 111,
            NUMPAD_ENTER: 108,
            NUMPAD_MULTIPLY: 106,
            NUMPAD_SUBTRACT: 109,
            PAGE_DOWN: 34,
            PAGE_UP: 33,
            PERIOD: 190,
            RIGHT: 39,
            SHIFT: 16,
            SPACE: 32,
            TAB: 9,
            UP: 38,
            WINDOWS: 91
        }
    }), f.fn.extend({
        propAttr: f.fn.prop || f.fn.attr,
        _focus: f.fn.focus,
        focus: function(a, d) {
            return typeof a == "number" ? this.each(function() {
                var b = this;
                setTimeout(function() {
                    f(b).focus(),
                    d && d.call(b)
                },
                a)
            }) : this._focus.apply(this, arguments)
        },
        scrollParent: function() {
            var a;
            f.browser.msie && /(static|relative)/.test(this.css("position")) || /absolute/.test(this.css("position")) ? a = this.parents().filter(function() {
                return /(relative|absolute|fixed)/.test(f.curCSS(this, "position", 1)) && /(auto|scroll)/.test(f.curCSS(this, "overflow", 1) + f.curCSS(this, "overflow-y", 1) + f.curCSS(this, "overflow-x", 1))
            }).eq(0) : a = this.parents().filter(function() {
                return /(auto|scroll)/.test(f.curCSS(this, "overflow", 1) + f.curCSS(this, "overflow-y", 1) + f.curCSS(this, "overflow-x", 1))
            }).eq(0);
            return /fixed/.test(this.css("position")) || !a.length ? f(document) : a
        },
        zIndex: function(j) {
            if (j !== e) {
                return this.css("zIndex", j)
            }
            if (this.length) {
                var i = f(this[0]),
                b,
                a;
                while (i.length && i[0] !== document) {
                    b = i.css("position");
                    if (b === "absolute" || b === "relative" || b === "fixed") {
                        a = parseInt(i.css("zIndex"), 10);
                        if (!isNaN(a) && a !== 0) {
                            return a
                        }
                    }
                    i = i.parent()
                }
            }
            return 0
        },
        disableSelection: function() {
            return this.bind((f.support.selectstart ? "selectstart": "mousedown") + ".ui-disableSelection",
            function(b) {
                b.preventDefault()
            })
        },
        enableSelection: function() {
            return this.unbind(".ui-disableSelection")
        }
    }), f.each(["Width", "Height"],
    function(l, k) {
        function a(m, p, o, n) {
            f.each(j,
            function() {
                p -= parseFloat(f.curCSS(m, "padding" + this, !0)) || 0,
                o && (p -= parseFloat(f.curCSS(m, "border" + this + "Width", !0)) || 0),
                n && (p -= parseFloat(f.curCSS(m, "margin" + this, !0)) || 0)
            });
            return p
        }
        var j = k === "Width" ? ["Left", "Right"] : ["Top", "Bottom"],
        i = k.toLowerCase(),
        b = {
            innerWidth: f.fn.innerWidth,
            innerHeight: f.fn.innerHeight,
            outerWidth: f.fn.outerWidth,
            outerHeight: f.fn.outerHeight
        };
        f.fn["inner" + k] = function(d) {
            if (d === e) {
                return b["inner" + k].call(this)
            }
            return this.each(function() {
                f(this).css(i, a(this, d) + "px")
            })
        },
        f.fn["outer" + k] = function(d, m) {
            if (typeof d != "number") {
                return b["outer" + k].call(this, d)
            };
            return this.each(function() {
                f(this).css(i, a(this, d, !0, m) + "px")
            });
        }
    }), f.extend(f.expr[":"], {
        data: function(a, j, i) {
            return !! f.data(a, i[3])
        },
        focusable: function(a) {
            return h(a, !isNaN(f.attr(a, "tabindex")))
        },
        tabbable: function(a) {
            var i = f.attr(a, "tabindex"),
            c = isNaN(i);
            return (c || i >= 0) && h(a, !c)
        }
    }), f(function() {
        var a = document.body,
        d = a.appendChild(d = document.createElement("div"));
        d.offsetHeight,
        f.extend(d.style, {
            minHeight: "100px",
            height: "auto",
            padding: 0,
            borderWidth: 0
        }),
        f.support.minHeight = d.offsetHeight === 100,
        f.support.selectstart = "onselectstart" in d,
        a.removeChild(d).style.display = "none"
    }), f.extend(f.ui, {
        plugin: {
            add: function(a, l, k) {
                var j = f.ui[a].prototype;
                for (var i in k) {
                    j.plugins[i] = j.plugins[i] || [],
                    j.plugins[i].push([l, k[i]])
                }
            },
            call: function(j, i, m) {
                var l = j.plugins[i];
                if ( !! l && !!j.element[0].parentNode) {
                    for (var k = 0; k < l.length; k++) {
                        j.options[l[k][0]] && l[k][1].apply(j.element, m)
                    }
                }
            }
        },
        contains: function(d, c) {
            return document.compareDocumentPosition ? d.compareDocumentPosition(c) & 16 : d !== c && d.contains(c)
        },
        hasScroll: function(a, k) {
            if (f(a).css("overflow") === "hidden") {
                return ! 1
            }
            var j = k && k === "left" ? "scrollLeft": "scrollTop",
            i = !1;
            if (a[j] > 0) {
                return ! 0
            }
            a[j] = 1,
            i = a[j] > 0,
            a[j] = 0;
            return i
        },
        isOverAxis: function(i, d, j) {
            return i > d && i < d + j
        },
        isOver: function(a, m, l, k, j, i) {
            return f.ui.isOverAxis(a, l, j) && f.ui.isOverAxis(m, k, i)
        }
    }))
})(jQuery);
/*
 * jQuery UI Widget 1.8.18
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(f, e) {
    if (f.cleanData) {
        var h = f.cleanData;
        f.cleanData = function(a) {
            for (var j = 0,
            i; (i = a[j]) != null; j++) {
                try {
                    f(i).triggerHandler("remove")
                } catch(c) {}
            }
            h(a);
        }
    } else {
        var g = f.fn.remove;
        f.fn.remove = function(a, d) {
            return this.each(function() {
                d || (!a || f.filter(a, [this]).length) && f("*", this).add([this]).each(function() {
                    try {
                        f(this).triggerHandler("remove")
                    } catch(c) {}
                });
                return g.call(f(this), a, d);
            });
        }
    }
    f.widget = function(a, m, l) {
        var k = a.split(".")[0],
        j;
        a = a.split(".")[1],
        j = k + "-" + a,
        l || (l = m, m = f.Widget),
        f.expr[":"][j] = function(b) {
            return !! f.data(b, a)
        },
        f[k] = f[k] || {},
        f[k][a] = function(d, c) {
            arguments.length && this._createWidget(d, c)
        };
        var i = new m;
        i.options = f.extend(!0, {},
        i.options),
        f[k][a].prototype = f.extend(!0, i, {
            namespace: k,
            widgetName: a,
            widgetEventPrefix: f[k][a].prototype.widgetEventPrefix || a,
            widgetBaseClass: j
        },
        l),
        f.widget.bridge(a, f[k][a])
    },
    f.widget.bridge = function(b, a) {
        f.fn[b] = function(j) {
            var i = typeof j == "string",
            d = Array.prototype.slice.call(arguments, 1),
            c = this;
            j = !i && d.length ? f.extend.apply(null, [!0, j].concat(d)) : j;
            if (i && j.charAt(0) === "_") {
                return c
            }
            i ? this.each(function() {
                var l = f.data(this, b),
                k = l && f.isFunction(l[j]) ? l[j].apply(l, d) : l;
                if (k !== l && k !== e) {
                    c = k;
                    return ! 1
                }
            }) : this.each(function() {
                var k = f.data(this, b);
                k ? k.option(j || {})._init() : f.data(this, b, new a(j, this))
            });
            return c
        }
    },
    f.Widget = function(d, c) {
        arguments.length && this._createWidget(d, c)
    },
    f.Widget.prototype = {
        widgetName: "widget",
        widgetEventPrefix: "",
        options: {
            disabled: !1
        },
        _createWidget: function(a, j) {
            f.data(j, this.widgetName, this),
            this.element = f(j),
            this.options = f.extend(!0, {},
            this.options, this._getCreateOptions(), a);
            var i = this;
            this.element.bind("remove." + this.widgetName,
            function() {
                i.destroy()
            }),
            this._create(),
            this._trigger("create"),
            this._init()
        },
        _getCreateOptions: function() {
            return f.metadata && f.metadata.get(this.element[0])[this.widgetName]
        },
        _create: function() {},
        _init: function() {},
        destroy: function() {
            this.element.unbind("." + this.widgetName).removeData(this.widgetName),
            this.widget().unbind("." + this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass + "-disabled ui-state-disabled")
        },
        widget: function() {
            return this.element
        },
        option: function(i, b) {
            var a = i;
            if (arguments.length === 0) {
                return f.extend({},
                this.options)
            }
            if (typeof i == "string") {
                if (b === e) {
                    return this.options[i]
                }
                a = {},
                a[i] = b
            }
            this._setOptions(a);
            return this
        },
        _setOptions: function(a) {
            var d = this;
            f.each(a,
            function(i, c) {
                d._setOption(i, c)
            });
            return this
        },
        _setOption: function(d, c) {
            this.options[d] = c,
            d === "disabled" && this.widget()[c ? "addClass": "removeClass"](this.widgetBaseClass + "-disabled ui-state-disabled").attr("aria-disabled", c);
            return this
        },
        enable: function() {
            return this._setOption("disabled", !1)
        },
        disable: function() {
            return this._setOption("disabled", !0)
        },
        _trigger: function(a, m, l) {
            var k, j, i = this.options[a];
            l = l || {},
            m = f.Event(m),
            m.type = (a === this.widgetEventPrefix ? a: this.widgetEventPrefix + a).toLowerCase(),
            m.target = this.element[0],
            j = m.originalEvent;
            if (j) {
                for (k in j) {
                    k in m || (m[k] = j[k])
                }
            }
            this.element.trigger(m, l);
            return ! (f.isFunction(i) && i.call(this.element[0], m, l) === !1 || m.isDefaultPrevented())
        }
    }
})(jQuery);
/*
 * jQuery UI Mouse 1.8.18
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
(function(e, d) {
    var f = !1;
    e(document).mouseup(function(b) {
        f = !1
    }),
    e.widget("ui.mouse", {
        options: {
            cancel: ":input,option",
            distance: 1,
            delay: 0
        },
        _mouseInit: function() {
            var a = this;
            this.element.bind("mousedown." + this.widgetName,
            function(b) {
                return a._mouseDown(b)
            }).bind("click." + this.widgetName,
            function(b) {
                if (!0 === e.data(b.target, a.widgetName + ".preventClickEvent")) {
                    e.removeData(b.target, a.widgetName + ".preventClickEvent"),
                    b.stopImmediatePropagation();
                    return ! 1
                }
            }),
            this.started = !1
        },
        _mouseDestroy: function() {
            this.element.unbind("." + this.widgetName)
        },
        _mouseDown: function(a) {
            if (!f) {
                this._mouseStarted && this._mouseUp(a),
                this._mouseDownEvent = a;
                var h = this,
                g = a.which == 1,
                c = typeof this.options.cancel == "string" && a.target.nodeName ? e(a.target).closest(this.options.cancel).length: !1;
                if (!g || c || !this._mouseCapture(a)) {
                    return ! 0
                }
                this.mouseDelayMet = !this.options.delay,
                this.mouseDelayMet || (this._mouseDelayTimer = setTimeout(function() {
                    h.mouseDelayMet = !0
                },
                this.options.delay));
                if (this._mouseDistanceMet(a) && this._mouseDelayMet(a)) {
                    this._mouseStarted = this._mouseStart(a) !== !1;
                    if (!this._mouseStarted) {
                        a.preventDefault();
                        return ! 0
                    }
                } ! 0 === e.data(a.target, this.widgetName + ".preventClickEvent") && e.removeData(a.target, this.widgetName + ".preventClickEvent"),
                this._mouseMoveDelegate = function(b) {
                    return h._mouseMove(b)
                },
                this._mouseUpDelegate = function(b) {
                    return h._mouseUp(b)
                },
                e(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate),
                a.preventDefault(),
                f = !0;
                return ! 0
            }
        },
        _mouseMove: function(a) {
            if (e.browser.msie && !(document.documentMode >= 9) && !a.button) {
                return this._mouseUp(a)
            }
            if (this._mouseStarted) {
                this._mouseDrag(a);
                return a.preventDefault()
            }
            this._mouseDistanceMet(a) && this._mouseDelayMet(a) && (this._mouseStarted = this._mouseStart(this._mouseDownEvent, a) !== !1, this._mouseStarted ? this._mouseDrag(a) : this._mouseUp(a));
            return ! this._mouseStarted
        },
        _mouseUp: function(a) {
            e(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate),
            this._mouseStarted && (this._mouseStarted = !1, a.target == this._mouseDownEvent.target && e.data(a.target, this.widgetName + ".preventClickEvent", !0), this._mouseStop(a));
            return ! 1
        },
        _mouseDistanceMet: function(b) {
            return Math.max(Math.abs(this._mouseDownEvent.pageX - b.pageX), Math.abs(this._mouseDownEvent.pageY - b.pageY)) >= this.options.distance
        },
        _mouseDelayMet: function(b) {
            return this.mouseDelayMet
        },
        _mouseStart: function(b) {},
        _mouseDrag: function(b) {},
        _mouseStop: function(b) {},
        _mouseCapture: function(b) {
            return ! 0
        }
    })
})(jQuery); (function(j, i) {
    j.ui = j.ui || {};
    var p = /left|center|right/,
    o = /top|center|bottom/,
    n = "center",
    m = {},
    l = j.fn.position,
    k = j.fn.offset;
    j.fn.position = function(c) {
        if (!c || !c.of) {
            return l.apply(this, arguments)
        }
        c = j.extend({},
        c);
        var q = j(c.of),
        g = q[0],
        f = (c.collision || "flip").split(" "),
        e = c.offset ? c.offset.split(" ") : [0, 0],
        d,
        a,
        r;
        g.nodeType === 9 ? (d = q.width(), a = q.height(), r = {
            top: 0,
            left: 0
        }) : g.setTimeout ? (d = q.width(), a = q.height(), r = {
            top: q.scrollTop(),
            left: q.scrollLeft()
        }) : g.preventDefault ? (c.at = "left top", d = a = 0, r = {
            top: c.of.pageY,
            left: c.of.pageX
        }) : (d = q.outerWidth(), a = q.outerHeight(), r = q.offset()),
        j.each(["my", "at"],
        function() {
            var b = (c[this] || "").split(" ");
            b.length === 1 && (b = p.test(b[0]) ? b.concat([n]) : o.test(b[0]) ? [n].concat(b) : [n, n]),
            b[0] = p.test(b[0]) ? b[0] : n,
            b[1] = o.test(b[1]) ? b[1] : n,
            c[this] = b
        }),
        f.length === 1 && (f[1] = f[0]),
        e[0] = parseInt(e[0], 10) || 0,
        e.length === 1 && (e[1] = e[0]),
        e[1] = parseInt(e[1], 10) || 0,
        c.at[0] === "right" ? r.left += d: c.at[0] === n && (r.left += d / 2),
        c.at[1] === "bottom" ? r.top += a: c.at[1] === n && (r.top += a / 2),
        r.left += e[0],
        r.top += e[1];
        return this.each(function() {
            var z = j(this),
            y = z.outerWidth(),
            x = z.outerHeight(),
            w = parseInt(j.curCSS(this, "marginLeft", !0)) || 0,
            v = parseInt(j.curCSS(this, "marginTop", !0)) || 0,
            u = y + w + (parseInt(j.curCSS(this, "marginRight", !0)) || 0),
            t = x + v + (parseInt(j.curCSS(this, "marginBottom", !0)) || 0),
            s = j.extend({},
            r),
            b;
            c.my[0] === "right" ? s.left -= y: c.my[0] === n && (s.left -= y / 2),
            c.my[1] === "bottom" ? s.top -= x: c.my[1] === n && (s.top -= x / 2),
            m.fractions || (s.left = Math.round(s.left), s.top = Math.round(s.top)),
            b = {
                left: s.left - w,
                top: s.top - v
            },
            j.each(["left", "top"],
            function(A, h) {
                j.ui.position[f[A]] && j.ui.position[f[A]][h](s, {
                    targetWidth: d,
                    targetHeight: a,
                    elemWidth: y,
                    elemHeight: x,
                    collisionPosition: b,
                    collisionWidth: u,
                    collisionHeight: t,
                    offset: e,
                    my: c.my,
                    at: c.at
                })
            }),
            j.fn.bgiframe && z.bgiframe(),
            z.offset(j.extend(s, {
                using: c.using
            }))
        })
    },
    j.ui.position = {
        fit: {
            left: function(a, h) {
                var g = j(window),
                f = h.collisionPosition.left + h.collisionWidth - g.width() - g.scrollLeft();
                a.left = f > 0 ? a.left - f: Math.max(a.left - h.collisionPosition.left, a.left)
            },
            top: function(a, h) {
                var g = j(window),
                f = h.collisionPosition.top + h.collisionHeight - g.height() - g.scrollTop();
                a.top = f > 0 ? a.top - f: Math.max(a.top - h.collisionPosition.top, a.top)
            }
        },
        flip: {
            left: function(a, u) {
                if (u.at[0] !== n) {
                    var t = j(window),
                    s = u.collisionPosition.left + u.collisionWidth - t.width() - t.scrollLeft(),
                    r = u.my[0] === "left" ? -u.elemWidth: u.my[0] === "right" ? u.elemWidth: 0,
                    q = u.at[0] === "left" ? u.targetWidth: -u.targetWidth,
                    e = -2 * u.offset[0];
                    a.left += u.collisionPosition.left < 0 ? r + q + e: s > 0 ? r + q + e: 0
                }
            },
            top: function(a, u) {
                if (u.at[1] !== n) {
                    var t = j(window),
                    s = u.collisionPosition.top + u.collisionHeight - t.height() - t.scrollTop(),
                    r = u.my[1] === "top" ? -u.elemHeight: u.my[1] === "bottom" ? u.elemHeight: 0,
                    q = u.at[1] === "top" ? u.targetHeight: -u.targetHeight,
                    e = -2 * u.offset[1];
                    a.top += u.collisionPosition.top < 0 ? r + q + e: s > 0 ? r + q + e: 0
                }
            }
        }
    },
    j.offset.setOffset || (j.offset.setOffset = function(a, v) { / static / .test(j.curCSS(a, "position")) && (a.style.position = "relative");
        var u = j(a),
        t = u.offset(),
        s = parseInt(j.curCSS(a, "top", !0), 10) || 0,
        r = parseInt(j.curCSS(a, "left", !0), 10) || 0,
        q = {
            top: v.top - t.top + s,
            left: v.left - t.left + r
        };
        "using" in v ? v.using.call(a, q) : u.css(q)
    },
    j.fn.offset = function(a) {
        var d = this[0];
        if (!d || !d.ownerDocument) {
            return null
        }
        if (a) {
            return this.each(function() {
                j.offset.setOffset(this, a)
            })
        }
        return k.call(this)
    }),
    function() {
        var a = document.getElementsByTagName("body")[0],
        v = document.createElement("div"),
        u,
        t,
        s,
        r,
        q;
        u = document.createElement(a ? "div": "body"),
        s = {
            visibility: "hidden",
            width: 0,
            height: 0,
            border: 0,
            margin: 0,
            background: "none"
        },
        a && j.extend(s, {
            position: "absolute",
            left: "-1000px",
            top: "-1000px"
        });
        for (var f in s) {
            u.style[f] = s[f]
        }
        u.appendChild(v),
        t = a || document.documentElement,
        t.insertBefore(u, t.firstChild),
        v.style.cssText = "position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;",
        r = j(v).offset(function(d, c) {
            return c
        }).offset(),
        u.innerHTML = "",
        t.removeChild(u),
        q = r.top + r.left + (a ? 2000 : 0),
        m.fractions = q > 21 && q < 22
    } ()
})(jQuery); (function(e, d) {
    var f = 0;
    e.widget("ui.autocomplete", {
        options: {
            appendTo: "body",
            autoFocus: !1,
            delay: 300,
            minLength: 1,
            position: {
                my: "left top",
                at: "left bottom",
                collision: "none"
            },
            source: null
        },
        pending: 0,
        _create: function() {
            var a = this,
            h = this.element[0].ownerDocument,
            g;
            this.element.addClass("ui-autocomplete-input").attr("autocomplete", "off").attr({
                role: "textbox",
                "aria-autocomplete": "list",
                "aria-haspopup": "true"
            }).bind("keydown.autocomplete",
            function(i) {
                if (!a.options.disabled && !a.element.propAttr("readOnly")) {
                    g = !1;
                    var b = e.ui.keyCode;
                    switch (i.keyCode) {
                    case b.PAGE_UP:
                        a._move("previousPage", i);
                        break;
                    case b.PAGE_DOWN:
                        a._move("nextPage", i);
                        break;
                    case b.UP:
                        a._move("previous", i),
                        i.preventDefault();
                        break;
                    case b.DOWN:
                        a._move("next", i),
                        i.preventDefault();
                        break;
                    case b.ENTER:
                    case b.NUMPAD_ENTER:
                        a.menu.active && (g = !0, i.preventDefault());
                    case b.TAB:
                        if (!a.menu.active) {
                            return
                        }
                        a.menu.select(i);
                        break;
                    case b.ESCAPE:
                        a.element.val(a.term),
                        a.close(i);
                        break;
                    default:
                        clearTimeout(a.searching),
                        a.searching = setTimeout(function() {
                            a.term != a.element.val() && (a.selectedItem = null, a.search(null, i))
                        },
                        a.options.delay)
                    }
                }
            }).bind("keypress.autocomplete",
            function(b) {
                g && (g = !1, b.preventDefault())
            }).bind("focus.autocomplete",
            function() {
                a.options.disabled || (a.selectedItem = null, a.previous = a.element.val())
            }).bind("blur.autocomplete",
            function(b) {
                a.options.disabled || (clearTimeout(a.searching), a.closing = setTimeout(function() {
                    a.close(b),
                    a._change(b)
                },
                150))
            }),
            this._initSource(),
            this.response = function() {
                return a._response.apply(a, arguments)
            },
            this.menu = e("<ul></ul>").addClass("ui-autocomplete").appendTo(e(this.options.appendTo || "body", h)[0]).mousedown(function(i) {
                var b = a.menu.element[0];
                e(i.target).closest(".ui-menu-item").length || setTimeout(function() {
                    e(document).one("mousedown",
                    function(j) {
                        j.target !== a.element[0] && j.target !== b && !e.ui.contains(b, j.target) && a.close()
                    })
                },
                1),
                setTimeout(function() {
                    clearTimeout(a.closing)
                },
                13)
            }).menu({
                focus: function(b, j) {
                    var i = j.item.data("item.autocomplete"); ! 1 !== a._trigger("focus", b, {
                        item: i
                    }) && /^key/.test(b.originalEvent.type) && a.element.val(i.value)
                },
                selected: function(b, j) {
                    var i = j.item.data("item.autocomplete"),
                    c = a.previous;
                    a.element[0] !== h.activeElement && (a.element.focus(), a.previous = c, setTimeout(function() {
                        a.previous = c,
                        a.selectedItem = i
                    },
                    1)),
                    !1 !== a._trigger("select", b, {
                        item: i
                    }) && a.element.val(i.value),
                    a.term = a.element.val(),
                    a.close(b),
                    a.selectedItem = i
                },
                blur: function(b, i) {
                    a.menu.element.is(":visible") && a.element.val() !== a.term && a.element.val(a.term)
                }
            }).zIndex(this.element.zIndex() + 1).css({
                top: 0,
                left: 0
            }).hide().data("menu"),
            e.fn.bgiframe && this.menu.element.bgiframe(),
            a.beforeunloadHandler = function() {
                a.element.removeAttr("autocomplete")
            },
            e(window).bind("beforeunload", a.beforeunloadHandler)
        },
        destroy: function() {
            this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup"),
            this.menu.element.remove(),
            e(window).unbind("beforeunload", this.beforeunloadHandler),
            e.Widget.prototype.destroy.call(this)
        },
        _setOption: function(a, g) {
            e.Widget.prototype._setOption.apply(this, arguments),
            a === "source" && this._initSource(),
            a === "appendTo" && this.menu.element.appendTo(e(g || "body", this.element[0].ownerDocument)[0]),
            a === "disabled" && g && this.xhr && this.xhr.abort()
        },
        _initSource: function() {
            var a = this,
            g, c;
            e.isArray(this.options.source) ? (g = this.options.source, this.source = function(h, i) {
                i(e.ui.autocomplete.filter(g, h.term))
            }) : typeof this.options.source == "string" ? (c = this.options.source, this.source = function(h, b) {
                a.xhr && a.xhr.abort(),
                a.xhr = e.ajax({
                    url: c,
                    data: h,
                    dataType: "json",
                    context: {
                        autocompleteRequest: ++f
                    },
                    success: function(j, i) {
                        this.autocompleteRequest === f && b(j)
                    },
                    error: function() {
                        this.autocompleteRequest === f && b([])
                    }
                })
            }) : this.source = this.options.source
        },
        search: function(g, c) {
            g = g != null ? g: this.element.val(),
            this.term = this.element.val();
            if (g.length < this.options.minLength) {
                return this.close(c)
            }
            clearTimeout(this.closing);
            if (this._trigger("search", c) !== !1) {
                return this._search(g)
            }
        },
        _search: function(b) {
            this.pending++,
            this.element.addClass("ui-autocomplete-loading"),
            this.source({
                term: b
            },
            this.response)
        },
        _response: function(b) { ! this.options.disabled && b && b.length ? (b = this._normalize(b), this._suggest(b), this._trigger("open")) : this.close(),
            this.pending--,
            this.pending || this.element.removeClass("ui-autocomplete-loading")
        },
        close: function(b) {
            clearTimeout(this.closing),
            this.menu.element.is(":visible") && (this.menu.element.hide(), this.menu.deactivate(), this._trigger("close", b))
        },
        _change: function(b) {
            this.previous !== this.element.val() && this._trigger("change", b, {
                item: this.selectedItem
            })
        },
        _normalize: function(a) {
            if (a.length && a[0].label && a[0].value) {
                return a
            }
            return e.map(a,
            function(c) {
                if (typeof c == "string") {
                    return {
                        label: c,
                        value: c
                    }
                }
                return e.extend({
                    label: c.label || c.value,
                    value: c.value || c.label
                },
                c)
            })
        },
        _suggest: function(a) {
            var g = this.menu.element.empty().zIndex(this.element.zIndex() + 1);
            this._renderMenu(g, a),
            this.menu.deactivate(),
            this.menu.refresh(),
            g.show(),
            this._resizeMenu(),
            g.position(e.extend({
                of: this.element
            },
            this.options.position)),
            this.options.autoFocus && this.menu.next(new e.Event("mouseover"))
        },
        _resizeMenu: function() {
            var b = this.menu.element;
            b.outerWidth(Math.max(b.width("").outerWidth() + 1, this.element.outerWidth()))
        },
        _renderMenu: function(a, h) {
            var g = this;
            e.each(h,
            function(b, i) {
                g._renderItem(a, i)
            })
        },
        _renderItem: function(a, g) {
            return e("<li></li>").data("item.autocomplete", g).append(e("<a></a>").text(g.label)).appendTo(a)
        },
        _move: function(g, c) {
            if (!this.menu.element.is(":visible")) {
                this.search(null, c)
            } else {
                if (this.menu.first() && /^previous/.test(g) || this.menu.last() && /^next/.test(g)) {
                    this.element.val(this.term),
                    this.menu.deactivate();
                    return
                }
                this.menu[g](c)
            }
        },
        widget: function() {
            return this.menu.element
        }
    }),
    e.extend(e.ui.autocomplete, {
        escapeRegex: function(b) {
            return b.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
        },
        filter: function(a, h) {
            var g = new RegExp(e.ui.autocomplete.escapeRegex(h), "i");
            return e.grep(a,
            function(b) {
                return g.test(b.label || b.value || b)
            })
        }
    })
})(jQuery),
function(b) {
    b.widget("ui.menu", {
        _create: function() {
            var a = this;
            this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({
                role: "listbox",
                "aria-activedescendant": "ui-active-menuitem"
            }).click(function(d) { ! b(d.target).closest(".ui-menu-item a").length || (d.preventDefault(), a.select(d))
            }),
            this.refresh()
        },
        refresh: function() {
            var a = this,
            d = this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role", "menuitem");
            d.children("a").addClass("ui-corner-all").attr("tabindex", -1).mouseenter(function(e) {
                a.activate(e, b(this).parent())
            }).mouseleave(function() {
                a.deactivate()
            })
        },
        activate: function(g, f) {
            this.deactivate();
            if (this.hasScroll()) {
                var j = f.offset().top - this.element.offset().top,
                i = this.element.scrollTop(),
                h = this.element.height();
                j < 0 ? this.element.scrollTop(i + j) : j >= h && this.element.scrollTop(i + j - h + f.height())
            }
            this.active = f.eq(0).children("a").addClass("ui-state-hover").attr("id", "ui-active-menuitem").end(),
            this._trigger("focus", g, {
                item: f
            })
        },
        deactivate: function() { ! this.active || (this.active.children("a").removeClass("ui-state-hover").removeAttr("id"), this._trigger("blur"), this.active = null)
        },
        next: function(c) {
            this.move("next", ".ui-menu-item:first", c)
        },
        previous: function(c) {
            this.move("prev", ".ui-menu-item:last", c)
        },
        first: function() {
            return this.active && !this.active.prevAll(".ui-menu-item").length
        },
        last: function() {
            return this.active && !this.active.nextAll(".ui-menu-item").length
        },
        move: function(f, e, h) {
            if (!this.active) {
                this.activate(h, this.element.children(e))
            } else {
                var g = this.active[f + "All"](".ui-menu-item").eq(0);
                g.length ? this.activate(h, g) : this.activate(h, this.element.children(e))
            }
        },
        nextPage: function(a) {
            if (this.hasScroll()) {
                if (!this.active || this.last()) {
                    this.activate(a, this.element.children(".ui-menu-item:first"));
                    return
                }
                var h = this.active.offset().top,
                g = this.element.height(),
                f = this.element.children(".ui-menu-item").filter(function() {
                    var c = b(this).offset().top - h - g + b(this).height();
                    return c < 10 && c > -10
                });
                f.length || (f = this.element.children(".ui-menu-item:last")),
                this.activate(a, f)
            } else {
                this.activate(a, this.element.children(".ui-menu-item").filter(!this.active || this.last() ? ":first": ":last"))
            }
        },
        previousPage: function(a) {
            if (this.hasScroll()) {
                if (!this.active || this.first()) {
                    this.activate(a, this.element.children(".ui-menu-item:last"));
                    return
                }
                var f = this.active.offset().top,
                e = this.element.height();
                result = this.element.children(".ui-menu-item").filter(function() {
                    var c = b(this).offset().top - f + e - b(this).height();
                    return c < 10 && c > -10
                }),
                result.length || (result = this.element.children(".ui-menu-item:first")),
                this.activate(a, result)
            } else {
                this.activate(a, this.element.children(".ui-menu-item").filter(!this.active || this.first() ? ":last": ":first"))
            }
        },
        hasScroll: function() {
            return this.element.height() < this.element[b.fn.prop ? "prop": "attr"]("scrollHeight")
        },
        select: function(c) {
            this._trigger("selected", c, {
                item: this.active
            })
        }
    })
} (jQuery); (function(e, d) {
    var f = 5;
    e.widget("ui.slider", e.ui.mouse, {
        widgetEventPrefix: "slide",
        options: {
            animate: !1,
            distance: 0,
            max: 100,
            min: 0,
            orientation: "horizontal",
            range: !1,
            step: 1,
            value: 0,
            values: null
        },
        _create: function() {
            var a = this,
            n = this.options,
            m = this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),
            l = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
            k = n.values && n.values.length || 1,
            j = [];
            this._keySliding = !1,
            this._mouseSliding = !1,
            this._animateOff = !0,
            this._handleIndex = null,
            this._detectOrientation(),
            this._mouseInit(),
            this.element.addClass("ui-slider ui-slider-" + this.orientation + " ui-widget ui-widget-content ui-corner-all" + (n.disabled ? " ui-slider-disabled ui-disabled": "")),
            this.range = e([]),
            n.range && (n.range === !0 && (n.values || (n.values = [this._valueMin(), this._valueMin()]), n.values.length && n.values.length !== 2 && (n.values = [n.values[0], n.values[0]])), this.range = e("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header" + (n.range === "min" || n.range === "max" ? " ui-slider-range-" + n.range: "")));
            for (var c = m.length; c < k; c += 1) {
                j.push(l)
            }
            this.handles = m.add(e(j.join("")).appendTo(a.element)),
            this.handle = this.handles.eq(0),
            this.handles.add(this.range).filter("a").click(function(b) {
                b.preventDefault()
            }).hover(function() {
                n.disabled || e(this).addClass("ui-state-hover")
            },
            function() {
                e(this).removeClass("ui-state-hover")
            }).focus(function() {
                n.disabled ? e(this).blur() : (e(".ui-slider .ui-state-focus").removeClass("ui-state-focus"), e(this).addClass("ui-state-focus"))
            }).blur(function() {
                e(this).removeClass("ui-state-focus")
            }),
            this.handles.each(function(g) {
                e(this).data("index.ui-slider-handle", g)
            }),
            this.handles.keydown(function(s) {
                var r = e(this).data("index.ui-slider-handle"),
                q,
                p,
                o,
                b;
                if (!a.options.disabled) {
                    switch (s.keyCode) {
                    case e.ui.keyCode.HOME:
                    case e.ui.keyCode.END:
                    case e.ui.keyCode.PAGE_UP:
                    case e.ui.keyCode.PAGE_DOWN:
                    case e.ui.keyCode.UP:
                    case e.ui.keyCode.RIGHT:
                    case e.ui.keyCode.DOWN:
                    case e.ui.keyCode.LEFT:
                        s.preventDefault();
                        if (!a._keySliding) {
                            a._keySliding = !0,
                            e(this).addClass("ui-state-active"),
                            q = a._start(s, r);
                            if (q === !1) {
                                return
                            }
                        }
                    }
                    b = a.options.step,
                    a.options.values && a.options.values.length ? p = o = a.values(r) : p = o = a.value();
                    switch (s.keyCode) {
                    case e.ui.keyCode.HOME:
                        o = a._valueMin();
                        break;
                    case e.ui.keyCode.END:
                        o = a._valueMax();
                        break;
                    case e.ui.keyCode.PAGE_UP:
                        o = a._trimAlignValue(p + (a._valueMax() - a._valueMin()) / f);
                        break;
                    case e.ui.keyCode.PAGE_DOWN:
                        o = a._trimAlignValue(p - (a._valueMax() - a._valueMin()) / f);
                        break;
                    case e.ui.keyCode.UP:
                    case e.ui.keyCode.RIGHT:
                        if (p === a._valueMax()) {
                            return
                        }
                        o = a._trimAlignValue(p + b);
                        break;
                    case e.ui.keyCode.DOWN:
                    case e.ui.keyCode.LEFT:
                        if (p === a._valueMin()) {
                            return
                        }
                        o = a._trimAlignValue(p - b)
                    }
                    a._slide(s, r, o)
                }
            }).keyup(function(g) {
                var b = e(this).data("index.ui-slider-handle");
                a._keySliding && (a._keySliding = !1, a._stop(g, b), a._change(g, b), e(this).removeClass("ui-state-active"))
            }),
            this._refreshValue(),
            this._animateOff = !1
        },
        destroy: function() {
            this.handles.remove(),
            this.range.remove(),
            this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"),
            this._mouseDestroy();
            return this
        },
        _mouseCapture: function(v) {
            var u = this.options,
            t, s, r, q, p, o, n, m, a;
            if (u.disabled) {
                return ! 1
            }
            this.elementSize = {
                width: this.element.outerWidth(),
                height: this.element.outerHeight()
            },
            this.elementOffset = this.element.offset(),
            t = {
                x: v.pageX,
                y: v.pageY
            },
            s = this._normValueFromMouse(t),
            r = this._valueMax() - this._valueMin() + 1,
            p = this,
            this.handles.each(function(g) {
                var h = Math.abs(s - p.values(g));
                r > h && (r = h, q = e(this), o = g)
            }),
            u.range === !0 && this.values(1) === u.min && (o += 1, q = e(this.handles[o])),
            n = this._start(v, o);
            if (n === !1) {
                return ! 1
            }
            this._mouseSliding = !0,
            p._handleIndex = o,
            q.addClass("ui-state-active").focus(),
            m = q.offset(),
            a = !e(v.target).parents().andSelf().is(".ui-slider-handle"),
            this._clickOffset = a ? {
                left: 0,
                top: 0
            }: {
                left: v.pageX - m.left - q.width() / 2,
                top: v.pageY - m.top - q.height() / 2 - (parseInt(q.css("borderTopWidth"), 10) || 0) - (parseInt(q.css("borderBottomWidth"), 10) || 0) + (parseInt(q.css("marginTop"), 10) || 0)
            },
            this.handles.hasClass("ui-state-hover") || this._slide(v, o, s),
            this._animateOff = !0;
            return ! 0
        },
        _mouseStart: function(b) {
            return ! 0
        },
        _mouseDrag: function(h) {
            var g = {
                x: h.pageX,
                y: h.pageY
            },
            i = this._normValueFromMouse(g);
            this._slide(h, this._handleIndex, i);
            return ! 1
        },
        _mouseStop: function(b) {
            this.handles.removeClass("ui-state-active"),
            this._mouseSliding = !1,
            this._stop(b, this._handleIndex),
            this._change(b, this._handleIndex),
            this._handleIndex = null,
            this._clickOffset = null,
            this._animateOff = !1;
            return ! 1
        },
        _detectOrientation: function() {
            this.orientation = this.options.orientation === "vertical" ? "vertical": "horizontal"
        },
        _normValueFromMouse: function(h) {
            var g, l, k, j, i;
            this.orientation === "horizontal" ? (g = this.elementSize.width, l = h.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left: 0)) : (g = this.elementSize.height, l = h.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top: 0)),
            k = l / g,
            k > 1 && (k = 1),
            k < 0 && (k = 0),
            this.orientation === "vertical" && (k = 1 - k),
            j = this._valueMax() - this._valueMin(),
            i = this._valueMin() + k * j;
            return this._trimAlignValue(i)
        },
        _start: function(h, g) {
            var i = {
                handle: this.handles[g],
                value: this.value()
            };
            this.options.values && this.options.values.length && (i.value = this.values(g), i.values = this.values());
            return this._trigger("start", h, i)
        },
        _slide: function(h, g, l) {
            var k, j, i;
            this.options.values && this.options.values.length ? (k = this.values(g ? 0 : 1), this.options.values.length === 2 && this.options.range === !0 && (g === 0 && l > k || g === 1 && l < k) && (l = k), l !== this.values(g) && (j = this.values(), j[g] = l, i = this._trigger("slide", h, {
                handle: this.handles[g],
                value: l,
                values: j
            }), k = this.values(g ? 0 : 1), i !== !1 && this.values(g, l, !0))) : l !== this.value() && (i = this._trigger("slide", h, {
                handle: this.handles[g],
                value: l
            }), i !== !1 && this.value(l))
        },
        _stop: function(h, g) {
            var i = {
                handle: this.handles[g],
                value: this.value()
            };
            this.options.values && this.options.values.length && (i.value = this.values(g), i.values = this.values()),
            this._trigger("stop", h, i)
        },
        _change: function(h, g) {
            if (!this._keySliding && !this._mouseSliding) {
                var i = {
                    handle: this.handles[g],
                    value: this.value()
                };
                this.options.values && this.options.values.length && (i.value = this.values(g), i.values = this.values()),
                this._trigger("change", h, i)
            }
        },
        value: function(b) {
            if (arguments.length) {
                this.options.value = this._trimAlignValue(b),
                this._refreshValue(),
                this._change(null, 0)
            } else {
                return this._value()
            }
        },
        values: function(a, j) {
            var i, h, g;
            if (arguments.length > 1) {
                this.options.values[a] = this._trimAlignValue(j),
                this._refreshValue(),
                this._change(null, a)
            } else {
                if (!arguments.length) {
                    return this._values()
                }
                if (!e.isArray(arguments[0])) {
                    return this.options.values && this.options.values.length ? this._values(a) : this.value()
                }
                i = this.options.values,
                h = arguments[0];
                for (g = 0; g < i.length; g += 1) {
                    i[g] = this._trimAlignValue(h[g]),
                    this._change(null, g)
                }
                this._refreshValue()
            }
        },
        _setOption: function(a, i) {
            var h, g = 0;
            e.isArray(this.options.values) && (g = this.options.values.length),
            e.Widget.prototype._setOption.apply(this, arguments);
            switch (a) {
            case "disabled":
                i ? (this.handles.filter(".ui-state-focus").blur(), this.handles.removeClass("ui-state-hover"), this.handles.propAttr("disabled", !0), this.element.addClass("ui-disabled")) : (this.handles.propAttr("disabled", !1), this.element.removeClass("ui-disabled"));
                break;
            case "orientation":
                this._detectOrientation(),
                this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-" + this.orientation),
                this._refreshValue();
                break;
            case "value":
                this._animateOff = !0,
                this._refreshValue(),
                this._change(null, 0),
                this._animateOff = !1;
                break;
            case "values":
                this._animateOff = !0,
                this._refreshValue();
                for (h = 0; h < g; h += 1) {
                    this._change(null, h)
                }
                this._animateOff = !1
            }
        },
        _value: function() {
            var b = this.options.value;
            b = this._trimAlignValue(b);
            return b
        },
        _values: function(h) {
            var g, j, i;
            if (arguments.length) {
                g = this.options.values[h],
                g = this._trimAlignValue(g);
                return g
            }
            j = this.options.values.slice();
            for (i = 0; i < j.length; i += 1) {
                j[i] = this._trimAlignValue(j[i])
            }
            return j
        },
        _trimAlignValue: function(h) {
            if (h <= this._valueMin()) {
                return this._valueMin()
            }
            if (h >= this._valueMax()) {
                return this._valueMax()
            }
            var g = this.options.step > 0 ? this.options.step: 1,
            j = (h - this._valueMin()) % g,
            i = h - j;
            Math.abs(j) * 2 >= g && (i += j > 0 ? g: -g);
            return parseFloat(i.toFixed(5))
        },
        _valueMin: function() {
            return this.options.min
        },
        _valueMax: function() {
            return this.options.max
        },
        _refreshValue: function() {
            var t = this.options.range,
            s = this.options,
            r = this,
            q = this._animateOff ? !1 : s.animate,
            p,
            o = {},
            n,
            m,
            l,
            a;
            this.options.values && this.options.values.length ? this.handles.each(function(c, g) {
                p = (r.values(c) - r._valueMin()) / (r._valueMax() - r._valueMin()) * 100,
                o[r.orientation === "horizontal" ? "left": "bottom"] = p + "%",
                e(this).stop(1, 1)[q ? "animate": "css"](o, s.animate),
                r.options.range === !0 && (r.orientation === "horizontal" ? (c === 0 && r.range.stop(1, 1)[q ? "animate": "css"]({
                    left: p + "%"
                },
                s.animate), c === 1 && r.range[q ? "animate": "css"]({
                    width: p - n + "%"
                },
                {
                    queue: !1,
                    duration: s.animate
                })) : (c === 0 && r.range.stop(1, 1)[q ? "animate": "css"]({
                    bottom: p + "%"
                },
                s.animate), c === 1 && r.range[q ? "animate": "css"]({
                    height: p - n + "%"
                },
                {
                    queue: !1,
                    duration: s.animate
                }))),
                n = p
            }) : (m = this.value(), l = this._valueMin(), a = this._valueMax(), p = a !== l ? (m - l) / (a - l) * 100 : 0, o[r.orientation === "horizontal" ? "left": "bottom"] = p + "%", this.handle.stop(1, 1)[q ? "animate": "css"](o, s.animate), t === "min" && this.orientation === "horizontal" && this.range.stop(1, 1)[q ? "animate": "css"]({
                width: p + "%"
            },
            s.animate), t === "max" && this.orientation === "horizontal" && this.range[q ? "animate": "css"]({
                width: 100 - p + "%"
            },
            {
                queue: !1,
                duration: s.animate
            }), t === "min" && this.orientation === "vertical" && this.range.stop(1, 1)[q ? "animate": "css"]({
                height: p + "%"
            },
            s.animate), t === "max" && this.orientation === "vertical" && this.range[q ? "animate": "css"]({
                height: 100 - p + "%"
            },
            {
                queue: !1,
                duration: s.animate
            }))
        }
    }),
    e.extend(e.ui.slider, {
        version: "1.8.18"
    })
})(jQuery);
var address = address || {};
address.dict = {};
address.loadDict = function() {
    $.getJSON("/api.php/json/building/" + $("input[name=entry_sn]").val(),
    function(a) {
        address.dict = a
    })
};
address.searchAddressJson = function(g) {
    g = $.trim(g).replace(/\s+/g, " ");
    if (g.length === 0) {
        return ""
    }
    var h = 0;
    var b = "";
    for (var e = 1; e <= g.length; e++) {
        var a = false;
        for (var f in address.dict.Regions) {
            if (address.dict.Regions[f].search($.trim(g.substring(0, e))) != -1) {
                h = e;
                b = f;
                a = true;
                break
            }
        }
        if (!a) {
            break
        }
    }
    if (address.isPinyin(g.substring(0, 5))) {
        if (h > 5) {
            g = g.substr(h)
        }
    } else {
        if (h > 1) {
            g = g.substr(h)
        }
    }
    var d = [];
    if (g.length === 0) {
        d.push(b + " ")
    } else {
        for (var c in address.dict.Buildings) {
            if (address.dict.Buildings[c].search(g) != -1) {
                if (b === "" || c.search(b) != -1) {
                    d.push(c + " ")
                }
            }
        }
    }
    return d
};
address.isPinyin = function(b) {
    for (var a = 0; a < b.length; a++) {
        if (b[a] < "A" || b[a] > "z") {
            return false
        }
    }
    return true
};
$(function() { (function() {
        $(".gum-food-item .food-action.add-to").click(function() {
            var entity_id = $(this).attr("entity_id");
            var left = $(this).offset().left + $(this).width() + 2;
            var top = $(this).offset().top;
            $(".add-to-box").css({
                left: left,
                top: top
            }).show();
            $(".add-to-box").find("li").each(function() {
                var href = $("a", this).attr("href") + "&entity_id=" + entity_id;
                $(this).find("a").attr("href", href)
            }).click(function(event) {
                window.location = $(this).attr("href")
            });
            return false
        });
        $("body").click(function(event) {
            if (! ($(event.target).parents().is(".add-to-box"))) {
                $(".add-to-box").hide()
            }
        })
    })(); (function() {
        $(".checkout-address-list li").hover(function() {
            $(this).find("a.delete").show()
        },
        function() {
            $(this).find("a.delete").hide()
        });
        $(".checkout-address-list li").click(function() {
            $(this).parent().find("li").removeClass("current");
            $(this).find("input").attr("checked", "checked");
            $(this).addClass("current");
            var id = $(this).find("input").val();
            var address = $(this).find(".address").html();
            var phone = $(this).find(".phone").html();
            var phone_bk = $(this).find(".phone-bk").html();
            $("#address").val(address);
            $("#phone").val(phone);
            $("#bak-phone").val(phone_bk);
            $("#addressId").val(id)
        });
        $(".checkout-invoice-list li").hover(function() {
            $(this).find("a.delete").show()
        },
        function() {
            $(this).find("a.delete").hide()
        });
        $("#showInvoice").click(function() {
            if ($(this).attr("checked")) {
                $("#invoice_detail").removeClass("hidden")
            } else {
                $("#invoice_detail").addClass("hidden");
                $("#invoice").val("");
                $("#invoiceId").val("")
            }
        });
        $(".checkout-invoice-list li").click(function() {
            $(this).parent().find("li").removeClass("current");
            $(this).find("input").attr("checked", "checked");
            $(this).addClass("current");
            var id = $(this).find("input").val();
            var invoicePayTo = $(this).find(".address").html();
            $("#invoicePayTo").val(invoicePayTo);
            $("#invoiceId").val(id);
            $("#invoice_input").val(invoicePayTo)
        })
    })(); (function() {
        $(".quick-notes span").click(function() {
            var desc = $("textarea").val();
            var $self = $(this);
            var delta_value = $self.html();
            if (desc.indexOf(delta_value) >= 0) {
                return false
            }
            var new_value = desc + delta_value + " ";
            $("textarea").val(new_value);
            $("#description").val(new_value)
        });
        $("textarea").change(function() {
            $("#description").val($(this).val())
        })
    })(); (function() {
        $("#checkout-form input").keypress(function(e) {
            var keyCode = e.keyCode ? e.keyCode: e.which ? e.which: e.charCode;
            if (keyCode == 13) {
                $("#confirm-button-normal").click();
                return false
            }
        })
    })(); (function() {
        var discount_value = $("#discount-value").val();
        var couponError = $("#couponError");
        $("#use-coupon-btn").click(function() {
            couponError.hide();
            $("#couponSn").val("apple");
            var origin_price = $(".total-price").html();
            var total_string = origin_price + "-" + discount_value + "=" + (origin_price - discount_value);
            $(".total-price").html(total_string);
            $(this).hide();
            $("#coupon-notice").html("已使用抵价券").css({
                display: "block",
                color: "#f63",
                marginTop: "9px",
                backgroundPosition: "3px -65px"
            }).show();
            return false
        })
    })(); (function() {
        if ($("#huanbao-double-point").size() >= 1) {
            function add_huanbao() {
                var origin_price = parseFloat($(".total-price").html());
                var total_string = origin_price + 0.1;
                $(".total-price").html(total_string);
                $("#use-rule-huanbao-double-point").val(1)
            }
            function remove_huanbao() {
                var origin_price = parseFloat($(".total-price").html());
                var total_string = origin_price - 0.1;
                $(".total-price").html(total_string);
                $("#use-rule-huanbao-double-point").val(0)
            }
            $("#huanbao-double-point").attr("checked", "checked");
            add_huanbao();
            $("#huanbao-double-point").click(function() {
                var $self = $(this);
                if ($self.is(":checked")) {
                    add_huanbao()
                } else {
                    remove_huanbao()
                }
            })
        }
    })();
    $("#online_payment_no").click(function() {
        $("#online_payment_toolkit").hide();
        $("#online_payment_no").parent().parent().css("background-color", "#F5F5F5");
        $("#online_payment_toolkit").parent().css("background-color", "");
        $("#online_payment_button").addClass("hide");
        $("#normal_payment_button").removeClass("hide")
    });
    $("#online_payment_yes").click(function() {
        $("#online_payment_toolkit").show();
        $("#online_payment_no").parent().parent().css("background", "white");
        $("#online_payment_toolkit").parent().css("height", "100px;");
        $("#online_payment_toolkit").parent().css("background-color", "#F5F5F5");
        $("#online_payment_button").removeClass("hide");
        $("#normal_payment_button").addClass("hide")
    });
    var count_down;
    var interval_id;
    function display_seconds(object) {
        object.val("等待" + count_down + "秒重新获取验证码");
        object.html("等待" + count_down + "秒重新获取验证码");
        if (count_down === 0) {
            clearInterval(interval_id);
            $("#send_terminal_code_success_txt").addClass("hidden");
            object.removeAttr("disabled");
            object.removeClass("disabled");
            object.val("获取验证码");
            object.html("获取验证码")
        }
        count_down = count_down - 1
    }
    function wait_for_seconds(object, seconds) {
        object.val("等待" + seconds + "秒重新获取验证码");
        object.html("等待" + seconds + "秒重新获取验证码");
        object.attr("disabled", "disabled");
        count_down = seconds - 1;
        $("#send_terminal_code_success_txt").removeClass("hidden");
        interval_id = setInterval(function() {
            display_seconds(object)
        },
        1000)
    }
    if ($("#send_terminal_code_btn").attr("diff")) {
        diff = $("#send_terminal_code_btn").attr("diff");
        if (diff < 60 && diff > 0) {
            wait_for_seconds($("#send_terminal_code_btn"), 60 - diff)
        } else {
            $("#send_terminal_code_btn").removeAttr("disabled")
        }
    } else {
        $("#send_terminal_code_btn").removeAttr("disabled")
    }
    $("#send_terminal_code_btn").click(function() {
        type = $(this).attr("terminal_type");
        $("#validate_terminal_error").addClass("hidden");
        $("#validate_terminal_error").parent().parent().removeClass("error");
        var terminal_type = $(this).attr("terminal_type");
        $(this).addClass("disabled");
        $.post($(this).attr("sendto"), {
            terminal_type: $(this).attr("terminal_type")
        },
        function(data) {
            data = eval("(" + data + ")");
            if (data.is_succeeded) {
                $("#send_mobile_code_error").html();
                wait_for_seconds($("#send_terminal_code_btn"), 60)
            } else {
                $("#send_terminal_code_btn").removeClass("disabled");
                $("#send_mobile_code_error").html(data.message)
            }
        });
        return false
    });
    $("#confirm-button-normal, #confirm-button-online").click(function() {
        function checkAddress() {
            var address = $("#address").val();
            if (address.length > 0) {
                $(".address-row").removeClass("error");
                return true
            } else {
                $(".address-row").addClass("error");
                $(".address-row").find(".help-inline").html("请填写正确的送餐地址!");
                return false
            }
        }
        function checkInvoice() {
            if ($("#showInvoice").attr("checked")) {
                var invoice = $("#invoice_input").val();
                if (invoice.length > 0) {
                    $(".invoice-row").removeClass("error");
                    $("#invoice").val(invoice);
                    return true
                } else {
                    $(".invoice-row").addClass("error");
                    $(".invoice-row").find(".help-block").html("请填写正确的发票抬头!");
                    return false
                }
            }
            return true
        }
        function checkPhone() {
            var phone = $("#phone").val();
            phone = phone.replace(/\D/g, "");
            var mobileReg = /^1[358]\d*/;
            if (mobileReg.test(phone) && phone.length != 11) {
                $(".phone-row").find(".help-inline").html("您输入的手机号码位数不对!");
                $(".phone-row").addClass("error");
                return false
            }
            if (phone.length <= 6 || phone.length > 15) {
                $(".phone-row").find(".help-inline").html("请输入正确的电话号码!");
                $(".phone-row").addClass("error");
                return false
            }
            $(".phone-row").removeClass("error");
            return true
        }
        function checkDeliverTime() {
            var $dom = $("#deliver_time");
            if ($dom.size() <= 0) {
                return true
            }
            var deliverTime = $dom.val();
            if (deliverTime == "please_select") {
                $(".deliver-time-row").addClass("error");
                return false;
                $canAccessPayment
            } else {
                $(".deliver-time-row").removeClass("error");
                return true
            }
        }
        function managePayment() {
            var is_online_paid = $("input[name=online_payment]:checked").val();
            var result = true;
            if (is_online_paid == 1) {
                var pwd = $("#payment_pwd").val();
                if (pwd.length > 0) {
                    $("#payment_password").val($("#payment_pwd").val());
                    $.ajax({
                        type: "POST",
                        async: false,
                        url: get_entry_url() + "/profile/checkUserPassword",
                        data: "username=" + $("#username").val() + "&password=" + $("#payment_password").val(),
                        success: function(data) {
                            if (data == "false" || data == false) {
                                $("#payment_password_error").html("密码错误");
                                $("#payment_password_error").parent().find("#payment_pwd_label, #payment_pwd, span").css({
                                    "border-color": "#B94A48",
                                    color: "#B94A48"
                                });
                                $("#payment_password_error").removeClass("hidden");
                                result = false
                            }
                        }
                    })
                } else {
                    $("#payment_password_error").html("请输入支付密码");
                    $("#payment_password_error").parent().find("label, input, span").css({
                        "border-color": "#B94A48",
                        color: "#B94A48"
                    });
                    $("#payment_password_error").removeClass("hidden");
                    result = false
                }
                if (!result) {
                    return false
                }
                if ($("#mobile_code_txt").length > 0) {
                    $.ajax({
                        type: "POST",
                        async: false,
                        url: $("#mobile_code_txt").attr("sendto"),
                        data: "terminal_type=0&validate_code=" + $("#mobile_code_txt").val(),
                        success: function(data) {
                            if (data.length > 0) {
                                data = eval("(" + data + ")");
                                $("#validate_terminal_error").removeClass("hidden");
                                $("#validate_terminal_error").html(data.message);
                                $("#validate_terminal_error").parent().find("label, input, span").css({
                                    "border-color": "#B94A48",
                                    color: "#B94A48"
                                });
                                if (data.disable_btn) {}
                                result = false
                            } else {
                                result = true
                            }
                        }
                    })
                }
            }
            $("#is_online_paid").val(is_online_paid);
            return result
        }
        var paymentOk = managePayment();
        var addressOk = checkAddress();
        var phoneOk = checkPhone();
        var deliverTimeOk = checkDeliverTime();
        var invoiceOk = checkInvoice();
        if (!addressOk || !phoneOk || !deliverTimeOk || !paymentOk || !invoiceOk) {
            return false
        }
        var btn = $(this);
        btn.button("loading");
        $("#checkout-form").submit()
    });
    address.loadDict();
    $("#address").autocomplete({
        minLength: 0,
        source: function(request, response) {
            var suggest = address.searchAddressJson(request.term);
            response(suggest)
        }
    });
    if ($("#online_payment_yes").attr("disabled")) {
        $("#online_payment_yes").parent().css("color", "#ccc")
    }
    $(".order-item").live("keyup",
    function(event) {
        var item_num = $(this).val();
        var price_each = $(this).parent().prev().attr("val");
        var total_num = 0;
        $(".order-item").each(function(i, v) {
            total_num += parseInt($(v).val())
        });
        var price_inline = item_num * price_each;
        var other_price = parseInt($("#other_price").attr("val"));
        var food_id = $(this).parent().parent().attr("rel");
        var url = no_cache_url(get_entry_url() + "/cart/set");
        var entity_id = $(this).attr("entity_id");
        var parent_entity_id = 0;
        var self = $(this);
        $.ajax({
            type: "POST",
            url: url,
            data: {
                item_num: item_num,
                food_id: food_id
            },
            success: function(e) {
                self.parent().next().html("￥" + price_inline).attr("value", price_inline);
                $("#total_quantity, #total_quantity_2").html(total_num);
                var total_price = 0;
                $(".inline-price").each(function(i, v) {
                    total_price += parseInt($(v).attr("value"))
                });
                $("#total_price, #total_price_2").html(total_price);
                if ($("#other_price").length > 0) {
                    var total_price_2 = total_price + other_price;
                    $("#total_price_2").html(total_price_2)
                }
            }
        });
        return false
    })
});
$(function() {
    if ($(".expbar").size() >= 1) {
        $(".expbar").each(function() {
            dianexia.expbar.animate(this)
        })
    }
});
if (typeof dianexia == "undefined") {
    dianexia = {}
}
dianexia.expbar = {};
dianexia.expbar.animate = function(q) {
    var o = parseInt($(".exp_from", q).text());
    var b = parseInt($(".exp_to", q).text());
    if (isNaN(o) || isNaN(b) || o > b) {
        return
    }
    var r = b - o;
    var l = 1;
    r = parseInt(r / 10);
    while (r > 0) {
        l = l * 10;
        r = parseInt(r / 10)
    }
    var m = parseInt(o / l) * l;
    var a = parseInt(b / l + 1) * l;
    var k = parseInt((m + a) / 2);
    var d = a - m;
    var i = $(q).width();
    var g = (o - m) / d * i;
    var n = (b - m) / d * i;
    var e = function(w, t, v) {
        var u = document.createElement(t);
        w.appendChild(u);
        $(u).addClass(v);
        return u
    };
    var p = e(q, "div", "inner_bar_wrapper");
    var h = e(q, "div", "ruler");
    var j = e(p, "div", "inner_bar");
    var s = e(h, "span", "ruler_from");
    var f = e(h, "span", "ruler_mid");
    var c = e(h, "span", "ruler_to");
    $(s).text(m);
    $(f).text(k);
    $(c).text(a);
    $(p).width($(p).width() - 2);
    $(j).width(g);
    $(j).animate({
        width: n
    },
    {
        duration: 3000
    })
};
var hexcase = 0;
var b64pad = "";
var chrsz = 8;
function hex_md5(a) {
    return binl2hex(core_md5(str2binl(a), a.length * chrsz))
}
function b64_md5(a) {
    return binl2b64(core_md5(str2binl(a), a.length * chrsz))
}
function str_md5(a) {
    return binl2str(core_md5(str2binl(a), a.length * chrsz))
}
function hex_hmac_md5(a, b) {
    return binl2hex(core_hmac_md5(a, b))
}
function b64_hmac_md5(a, b) {
    return binl2b64(core_hmac_md5(a, b))
}
function str_hmac_md5(a, b) {
    return binl2str(core_hmac_md5(a, b))
}
function md5_vm_test() {
    return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"
}
function core_md5(p, k) {
    p[k >> 5] |= 128 << ((k) % 32);
    p[(((k + 64) >>> 9) << 4) + 14] = k;
    var o = 1732584193;
    var n = -271733879;
    var m = -1732584194;
    var l = 271733878;
    for (var g = 0; g < p.length; g += 16) {
        var j = o;
        var h = n;
        var f = m;
        var e = l;
        o = md5_ff(o, n, m, l, p[g + 0], 7, -680876936);
        l = md5_ff(l, o, n, m, p[g + 1], 12, -389564586);
        m = md5_ff(m, l, o, n, p[g + 2], 17, 606105819);
        n = md5_ff(n, m, l, o, p[g + 3], 22, -1044525330);
        o = md5_ff(o, n, m, l, p[g + 4], 7, -176418897);
        l = md5_ff(l, o, n, m, p[g + 5], 12, 1200080426);
        m = md5_ff(m, l, o, n, p[g + 6], 17, -1473231341);
        n = md5_ff(n, m, l, o, p[g + 7], 22, -45705983);
        o = md5_ff(o, n, m, l, p[g + 8], 7, 1770035416);
        l = md5_ff(l, o, n, m, p[g + 9], 12, -1958414417);
        m = md5_ff(m, l, o, n, p[g + 10], 17, -42063);
        n = md5_ff(n, m, l, o, p[g + 11], 22, -1990404162);
        o = md5_ff(o, n, m, l, p[g + 12], 7, 1804603682);
        l = md5_ff(l, o, n, m, p[g + 13], 12, -40341101);
        m = md5_ff(m, l, o, n, p[g + 14], 17, -1502002290);
        n = md5_ff(n, m, l, o, p[g + 15], 22, 1236535329);
        o = md5_gg(o, n, m, l, p[g + 1], 5, -165796510);
        l = md5_gg(l, o, n, m, p[g + 6], 9, -1069501632);
        m = md5_gg(m, l, o, n, p[g + 11], 14, 643717713);
        n = md5_gg(n, m, l, o, p[g + 0], 20, -373897302);
        o = md5_gg(o, n, m, l, p[g + 5], 5, -701558691);
        l = md5_gg(l, o, n, m, p[g + 10], 9, 38016083);
        m = md5_gg(m, l, o, n, p[g + 15], 14, -660478335);
        n = md5_gg(n, m, l, o, p[g + 4], 20, -405537848);
        o = md5_gg(o, n, m, l, p[g + 9], 5, 568446438);
        l = md5_gg(l, o, n, m, p[g + 14], 9, -1019803690);
        m = md5_gg(m, l, o, n, p[g + 3], 14, -187363961);
        n = md5_gg(n, m, l, o, p[g + 8], 20, 1163531501);
        o = md5_gg(o, n, m, l, p[g + 13], 5, -1444681467);
        l = md5_gg(l, o, n, m, p[g + 2], 9, -51403784);
        m = md5_gg(m, l, o, n, p[g + 7], 14, 1735328473);
        n = md5_gg(n, m, l, o, p[g + 12], 20, -1926607734);
        o = md5_hh(o, n, m, l, p[g + 5], 4, -378558);
        l = md5_hh(l, o, n, m, p[g + 8], 11, -2022574463);
        m = md5_hh(m, l, o, n, p[g + 11], 16, 1839030562);
        n = md5_hh(n, m, l, o, p[g + 14], 23, -35309556);
        o = md5_hh(o, n, m, l, p[g + 1], 4, -1530992060);
        l = md5_hh(l, o, n, m, p[g + 4], 11, 1272893353);
        m = md5_hh(m, l, o, n, p[g + 7], 16, -155497632);
        n = md5_hh(n, m, l, o, p[g + 10], 23, -1094730640);
        o = md5_hh(o, n, m, l, p[g + 13], 4, 681279174);
        l = md5_hh(l, o, n, m, p[g + 0], 11, -358537222);
        m = md5_hh(m, l, o, n, p[g + 3], 16, -722521979);
        n = md5_hh(n, m, l, o, p[g + 6], 23, 76029189);
        o = md5_hh(o, n, m, l, p[g + 9], 4, -640364487);
        l = md5_hh(l, o, n, m, p[g + 12], 11, -421815835);
        m = md5_hh(m, l, o, n, p[g + 15], 16, 530742520);
        n = md5_hh(n, m, l, o, p[g + 2], 23, -995338651);
        o = md5_ii(o, n, m, l, p[g + 0], 6, -198630844);
        l = md5_ii(l, o, n, m, p[g + 7], 10, 1126891415);
        m = md5_ii(m, l, o, n, p[g + 14], 15, -1416354905);
        n = md5_ii(n, m, l, o, p[g + 5], 21, -57434055);
        o = md5_ii(o, n, m, l, p[g + 12], 6, 1700485571);
        l = md5_ii(l, o, n, m, p[g + 3], 10, -1894986606);
        m = md5_ii(m, l, o, n, p[g + 10], 15, -1051523);
        n = md5_ii(n, m, l, o, p[g + 1], 21, -2054922799);
        o = md5_ii(o, n, m, l, p[g + 8], 6, 1873313359);
        l = md5_ii(l, o, n, m, p[g + 15], 10, -30611744);
        m = md5_ii(m, l, o, n, p[g + 6], 15, -1560198380);
        n = md5_ii(n, m, l, o, p[g + 13], 21, 1309151649);
        o = md5_ii(o, n, m, l, p[g + 4], 6, -145523070);
        l = md5_ii(l, o, n, m, p[g + 11], 10, -1120210379);
        m = md5_ii(m, l, o, n, p[g + 2], 15, 718787259);
        n = md5_ii(n, m, l, o, p[g + 9], 21, -343485551);
        o = safe_add(o, j);
        n = safe_add(n, h);
        m = safe_add(m, f);
        l = safe_add(l, e)
    }
    return Array(o, n, m, l)
}
function md5_cmn(h, e, d, c, g, f) {
    return safe_add(bit_rol(safe_add(safe_add(e, h), safe_add(c, f)), g), d)
}
function md5_ff(g, f, k, j, e, i, h) {
    return md5_cmn((f & k) | ((~f) & j), g, f, e, i, h)
}
function md5_gg(g, f, k, j, e, i, h) {
    return md5_cmn((f & j) | (k & (~j)), g, f, e, i, h)
}
function md5_hh(g, f, k, j, e, i, h) {
    return md5_cmn(f ^ k ^ j, g, f, e, i, h)
}
function md5_ii(g, f, k, j, e, i, h) {
    return md5_cmn(k ^ (f | (~j)), g, f, e, i, h)
}
function core_hmac_md5(c, e) {
    var d = str2binl(c);
    if (d.length > 16) {
        d = core_md5(d, c.length * chrsz)
    }
    var a = Array(16),
    g = Array(16);
    for (var b = 0; b < 16; b++) {
        a[b] = d[b] ^ 909522486;
        opad[b] = d[b] ^ 1549556828
    }
    var f = core_md5(a.concat(str2binl(e)), 512 + e.length * chrsz);
    return core_md5(opad.concat(f), 512 + 128)
}
function safe_add(a, d) {
    var c = (a & 65535) + (d & 65535);
    var b = (a >> 16) + (d >> 16) + (c >> 16);
    return (b << 16) | (c & 65535)
}
function bit_rol(a, b) {
    return (a << b) | (a >>> (32 - b))
}
function str2binl(d) {
    var c = Array();
    var a = (1 << chrsz) - 1;
    for (var b = 0; b < d.length * chrsz; b += chrsz) {
        c[b >> 5] |= (d.charCodeAt(b / chrsz) & a) << (b % 32)
    }
    return c
}
function binl2str(c) {
    var d = "";
    var a = (1 << chrsz) - 1;
    for (var b = 0; b < c.length * 32; b += chrsz) {
        d += String.fromCharCode((c[b >> 5] >>> (b % 32)) & a)
    }
    return d
}
function binl2hex(c) {
    var b = hexcase ? "0123456789ABCDEF": "0123456789abcdef";
    var d = "";
    for (var a = 0; a < c.length * 4; a++) {
        d += b.charAt((c[a >> 2] >> ((a % 4) * 8 + 4)) & 15) + b.charAt((c[a >> 2] >> ((a % 4) * 8)) & 15)
    }
    return d
}
function binl2b64(d) {
    var c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
    var f = "";
    for (var b = 0; b < d.length * 4; b += 3) {
        var e = (((d[b >> 2] >> 8 * (b % 4)) & 255) << 16) | (((d[b + 1 >> 2] >> 8 * ((b + 1) % 4)) & 255) << 8) | ((d[b + 2 >> 2] >> 8 * ((b + 2) % 4)) & 255);
        for (var a = 0; a < 4; a++) {
            if (b * 8 + a * 6 > d.length * 32) {
                f += b64pad
            } else {
                f += c.charAt((e >> 6 * (3 - a)) & 63)
            }
        }
    }
    return f
};